#ifndef BIBLEREADERRESOURCEMANAGERDLG_H
#define BIBLEREADERRESOURCEMANAGERDLG_H
#include <QDialog>
#include <QTreeWidget>
#include <QLabel>
#include <QProgressDialog>
#include "biblereadercore.h"


class BibleReaderResourceManagerDlg: public QDialog
{
    Q_OBJECT
public:
    BibleReaderResourceManagerDlg(BibleReaderCore *brc, QWidget *parent = nullptr);
    ~BibleReaderResourceManagerDlg();

private:
    QTreeWidget *resItemsWidget;
    QPushButton *refreshBtn;
    QPushButton *closeBtn;
    QProgressDialog *proccessResDlg;

    BibleReaderCore *brCore;
    BibleReaderResourceManager *manager;

    QString appFile;

private:
    void createWidgets();
    void doLayout();
    QWidget* createButtons(BRResource resource);

    // combine resources
    void mergeResources(QList<BRResource> &resources);

private slots:
    void updateResList();
    void installRes();
    void updateRes();
    bool removeRes();
    void showProgress(qint64 a, qint64 b);
    void proccessOperationResult(QString operation, bool result);
};

#endif // BIBLEREADERRESOURCEMANAGERDLG_H
